#ifndef TC_TYPEINFO_HH
#define TC_TYPEINFO_HH

/** \file TypeInfo.hh 
 * Declarations for the class TypeInfo.
 *
 * (c) Copyright Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * This class has been derived from the software copyrighted as follows:
 * Copyright (c) 2001 by Andrei Alexandrescu
 * This code accompanies the book:
 * Alexandrescu, Andrei. "Modern C++ Design: Generic Programming 
 * and Design Patterns Applied". Copyright (c) 2001. Addison-Wesley.
 * Permission to use, copy, modify, distribute and sell this 
 * software for any purpose is hereby granted without fee, 
 * provided that the above copyright notice appear in all copies 
 * and that both that copyright notice and this permission notice 
 * appear in supporting documentation.
 * The author or Addison-Wesley Longman make no representations about
 * the suitability of this software for any purpose. It is provided
 * "as is" without express or implied warranty.
 *
 *
 * $Id: TypeInfo.hh 119 2006-06-21 04:57:25Z semihc $
 *
 *
 */

#include <typeinfo>
#include <cstddef>
#include "Global.hh"


namespace TC {

  /**
   * This class offers a first-class, 
   * comparable wrapper over std::type_info.
   */
  class TypeInfo
  {
  public:
    // CREATORS
    // Default ctor needed for containers
    TypeInfo() : m_info(&typeid(void)) {} 
    // Non-explicit ctor for implicit conversion
    TypeInfo(const std::type_info& info) : m_info(&info) {}

    // Default copy ctor, copy asgnmt, dtor are fine.

    // ACCESSORS
    // Access for the wrapped std::type_info
    const std::type_info& getInfo() const;

    // Compatibility functions
    bool before(const TypeInfo& rhs) const;
    const char* name() const;

  protected:
    // MEMBERS
    const std::type_info* m_info;

  }; // end class



  //
  // Comparison operators
  //
  TC_INLINE bool operator==(const TypeInfo& lhs, const TypeInfo& rhs);
  TC_INLINE bool operator<(const TypeInfo& lhs, const TypeInfo& rhs);
  TC_INLINE bool operator!=(const TypeInfo& lhs, const TypeInfo& rhs);
  TC_INLINE bool operator>(const TypeInfo& lhs, const TypeInfo& rhs);
  TC_INLINE bool operator<=(const TypeInfo& lhs, const TypeInfo& rhs);
  TC_INLINE bool operator>=(const TypeInfo& lhs, const TypeInfo& rhs);


} // end namespace


// Include inline function definitions
#ifdef TC_USE_INLINE
# include "TypeInfo.inl"
#endif



#endif /* Include guard */
